package common;

/**
 * 对应键盘上的各个键值
 * @author cccssw
 * 
 */
public class KeyCodes {

    public static int TranslateKeyCode(String str) {
        int p;
        p = Integer.parseInt(str);
        //mapping p
        if (p == -1) {
            return KeyCodes.KEY_UP_ARROW;
        }
        if (p == -2) {
            return KeyCodes.KEY_DOWN_ARROW;
        }
        if (p == -3) {
            return KeyCodes.KEY_LEFT_ARROW;
        }
        if (p == -4) {
            return KeyCodes.KEY_RIGHT_ARROW;
        }

        if (p >= 97 && p <= 122) {
            p = p - 32;
        } //A-Z

        return p;

    }
    /**  数字键 KEY 0~9   **/
    public static int KEY_0 = 48;
    public static int KEY_1 = 49;
    public static int KEY_2 = 50;
    public static int KEY_3 = 51;
    public static int KEY_4 = 52;
    public static int KEY_5 = 53;
    public static int KEY_6 = 54;
    public static int KEY_7 = 55;
    public static int KEY_8 = 56;
    public static int KEY_9 = 57;
    /**  数字键盘上的键值 **/
    public static int KEY_NUM_0 = 0x60;
    public static int KEY_NUM_1 = 0x61;
    public static int KEY_NUM_2 = 0x62;
    public static int KEY_NUM_3 = 0x63;
    public static int KEY_NUM_4 = 0x64;
    public static int KEY_NUM_5 = 0x65;
    public static int KEY_NUM_6 = 0x66;
    public static int KEY_NUM_7 = 0x67;
    public static int KEY_NUM_8 = 0x68;
    public static int KEY_NUM_9 = 0x69;
    public static int KEY_NUM_MULTIPLICATION = 0x6A;         /* 数字键盘乘法 */

    public static int KEY_NUM_PLUS = 0x6B;                   /* 数字键盘加号 */

    public static int KEY_NUM_ENTER = 0x6C;                  /* 数字键盘回车 */

    public static int KEY_NUM_MINUS = 0x6D;	               /* 数字键盘减法 */

    public static int KEY_NUM_DECIMAL = 0x6E;                /* 数字键盘点号 */

    public static int KEY_NUM_DIVISION = 0x6F;               /* 数字键盘除号 */

    /**  字母键 KEY A~Z  **/
    public static int KEY_A = 65;
    public static int KEY_B = 66;
    public static int KEY_C = 67;
    public static int KEY_D = 68;
    public static int KEY_E = 69;
    public static int KEY_F = 70;
    public static int KEY_G = 71;
    public static int KEY_H = 72;
    public static int KEY_I = 73;
    public static int KEY_J = 74;
    public static int KEY_K = 75;
    public static int KEY_L = 76;
    public static int KEY_M = 77;
    public static int KEY_N = 78;
    public static int KEY_O = 79;
    public static int KEY_P = 80;
    public static int KEY_Q = 81;
    public static int KEY_R = 82;
    public static int KEY_S = 83;
    public static int KEY_T = 84;
    public static int KEY_U = 85;
    public static int KEY_V = 86;
    public static int KEY_W = 87;
    public static int KEY_X = 88;
    public static int KEY_Y = 89;
    public static int KEY_Z = 90;
    /** 功能键 KEY F1~F12 **/
    public static int KEY_F1 = 0x70;
    public static int KEY_F2 = 0x71;
    public static int KEY_F3 = 0x72;
    public static int KEY_F4 = 0x73;
    public static int KEY_F5 = 0x74;
    public static int KEY_F6 = 0x75;
    public static int KEY_F7 = 0x76;
    public static int KEY_F8 = 0x77;
    public static int KEY_F9 = 0x78;
    public static int KEY_F10 = 0x79;
    public static int KEY_F11 = 0x7A;
    public static int KEY_F12 = 0x7B;
    /** 方向键   ↑ ↓ ← →  **/
    public static int KEY_LEFT_ARROW = 0x25;
    public static int KEY_UP_ARROW = 0x26;
    public static int KEY_RIGHT_ARROW = 0x27;
    public static int KEY_DOWN_ARROW = 0x28;
    /**  翻页键 page ↑ ↓  **/
    public static int KEY_PAGE_UP = 0x21;
    public static int KEY_PAGE_DOWN = 0x22;
    public static int KEY_END = 0x23;
    public static int KEY_HOME = 0x24;
    /**  常用键 ctrl tab enter.... **/
    public static int KEY_BACKSPACE = 0x8;                   /* 回格键  */

    public static int KEY_TAB = 0x9;	                       /* tab 键 */

    public static int KEY_SHIFT = 0x10;                      /* shift键 */

    public static int KEY_CTRL = 0x11;                       /* ctrl键 */

    public static int KEY_MENU = 0x20c;	                    /* 徽标键 */

    public static int KEY_ENTER = 0xa;                       /* 回车键 */

    public static int KEY_CAPS_LOCK = 0x14;                  /* 大些锁定键 */

    public static int KEY_ESC = 0x1B;                        /* Esc键 */

    public static int KEY_NUM_LOCK = 0x90;                   /* 数字键 */

    public static int KEY_ALT = 0x12;                        /* ALT键 */

    /** 其他常用键  **/
    public static int KEY_CLEAR = 0xC;
    public static int KEY_PAUSE = 0x13;
    public static int KEY_SPACEBAR = 0x20;
    public static int KEY_SELECT = 0x29;
    public static int KEY_PRINT_SCREEN = 0x2A;
    public static int KEY_EXECUTE = 0x2B;
    public static int KEY_SNAPSHOT = 0x2C;
    public static int KEY_INSERT = 0x2D;
    public static int KEY_DELETE = 0x2E;
    public static int KEY_HELP = 0x2F;
}
